<?php


namespace app\cuisine\validate;


use think\Validate;

class NewsValidate extends Validate
{
    //验证规则
    public $rule =[
        'title' => 'require|max:30',
        'author'=>'require',
        'abstract'=>'require',
        'content'=>'require',
        'image'=>'require',
        'look_num'=>'require|integer',
    ];
    //验证提示信息
    public $message = [
      'title.require' => '标题不能为空',
      'title.max' => '标题字数过长',
      'author.require' => '作者不能为空',
      'abstract.require' => '摘要不能为空',
      'content.require' => '内容不能为空',
      'image.require' => '封面图片不能为空',
      'look_num.require' => '浏览量不能为空',
      'look_num.integer' => '浏览量应为整数',
    ];
    //验证场景
    public $scene = [
        'add'=>['title','author','abstract','content','image','look_num'],
        'edit'=>['title','author','abstract','content','image','look_num'],
    ];
}